<template>
	<view>
		<!-- <text>个人中心</text> -->
		<view class="my-container">
			<view class="my-user-title">
				<!-- <image :src="userInfo.avatarUrl"></image>
				<view class="nickname">{{userInfo.nickName}}</view> -->
				<!-- <image :src="userInfo.avatarUrl" mode=""></image>
				<view class="">
					昵称
				</view> -->
				
				<image :src="userInfo.userInfo.avatarUrl" class="avatar" mode=""></image>
				<view class="nickname">{{userInfo.userInfo.nickName}}</view>
				
			</view>
			<view class="my-body">
				<view class="panel">
					<view class="panel-item">
						<text>8</text>
						<text>收藏的店铺</text>
					</view>
					<view class="panel-item">
						<text>4</text>
						<text>收藏的商品</text>
					</view>
					<view class="panel-item">
						<text>1</text>
						<text>关注的商品</text>
					</view>
					<view class="panel-item">
						<text>67</text>
						<text>足迹</text>
					</view>
				</view>
				
				<view class="panel-two">
					<view class="panel-two-top">
						<text>我的订单</text>
					</view>
					
					<view class="panel-two-bottom">
						<view class="panel-item-two">
							<image src="../../static/my-icons/icon1.png" mode=""></image>
							<text>待付款</text>
						</view>
						
						<view class="panel-item-two">
							<image src="../../static/my-icons/icon2.png" mode=""></image>
							<text>待收货</text>
						</view>
						
						<view class="panel-item-two">
							<image src="../../static/my-icons/icon3.png" mode=""></image>
							<text>退款/退货</text>
						</view>
						
						<view class="panel-item-two">
							<image src="../../static/my-icons/icon4.png" mode=""></image>
							<text>全部订单</text>
						</view>
					</view>
				</view>
				
				<view class="panel-three">
					<view class="panel-three-one">
						<text>收货地址</text>
						<uni-icons type="right"></uni-icons>
					</view>
					<view class="panel-three-two">
						<text>联系客服</text>
						<uni-icons type="right"></uni-icons>
					</view>
					<view class="panel-three-three">
						<text>退出登录</text>
						<uni-icons type="right"></uni-icons>
					</view>
				</view>
			</view>
			<view class="login-exit">
				<button type="primary" @click="loginExit">退出登录</button>
			</view>
		</view>
	</view>
</template>

<script>
	import {mapState,mapMutations} from 'vuex';
	export default {
		name:"my-userInfo",
		computed:{
			...mapState('user_m',['userInfo']),
			
		},
		data() {
			return {
			};
		},
		methods:{
			...mapMutations('user_m',['updateToken','updateUserInfo','updateAddress']),
			async loginExit(){
				console.log(111);
				const [err,succ] = await uni.showModal({
					title:'提示',
					content:'您确认要退出登录吗？',
					
					
				}).catch(err=>err);
				// console.log(result);
				if(succ && succ.confirm){
					this.updateToken('');
					this.updateUserInfo({});
					this.updateAddress({});
				}
			}
		}
	}
	
</script>

<style lang="scss">
page , .my-container{
	height: 100%;
	background-color: #2979FF;
	.my-user-title {
		height: 500rpx;
		background-color: #E43D33;
		display: flex;
		justify-content: center;
		align-items: center;
		flex-direction: column;
		.avatar {
			width: 100px;
			height: 100px;
			border-radius: 50%;
			border: 3px solid white;
			box-shadow: 0 1px 3px pink; 
		}
		.nickname{
			color: #18BC37;
			margin-top: 10px;
			
		}
	}
	.my-body {
		
		position: relative;
		top: -10px;
		.panel {
			display: flex;
			
			
			background-color: white;
			border-radius: 5px;
			width: 90%;
			margin-left: 5%;
			.panel-item {
				display: flex;
				flex-wrap: wrap;
				justify-content: center;
				text {
					margin: 3px 5px;
				}
			}
		}
		
		.panel-two {
			background-color: white;
			border-radius: 5px;
			width: 90%;
			margin-left: 5%;
			margin-top: 30px;
			
			.panel-two-top {
				color: #2979FF;
				display: flex;
				flex-wrap: wrap;
				border-bottom: 1px solid #3A3A3A;
				margin: 3px 5px;
			}
			.panel-two-bottom {
				display: flex;
				margin: 10px 0;
				.panel-item-two{
					display: flex;
					flex-wrap: wrap;
					justify-content: center;
					image {
						width: 40px;
						height: 40px;
					}
				}
			}
		}
		
		.panel-three {
			background-color: white;
			border-radius: 5px;
			width: 90%;
			margin-left: 5%;
			margin-top: 30px;
			.panel-three-two {
				margin: 18px 0;
			}
			.panel-three-one,.panel-three-two,.panel-three-three {
				display: flex;
				justify-content: space-between;
			}
		}
	}
}
</style>
